package ao.com.bna.beans;

import java.io.Serializable;
import java.util.Collection;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name = "TIPONOTIFICACAO")
public class TipoNotificacao implements Serializable {
	
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(name="ID_TIPONOTIFICACAO_GENERATOR", sequenceName="TIPONOTIFICACAO_SEQ", allocationSize=1)
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="ID_TIPONOTIFICACAO_GENERATOR")
	
	@Column(nullable = false, precision = 6)
	private Long idTipoNotificacao;
	
	@Column(length=40)
	private String descricao;
	
	@OneToMany(mappedBy = "tipoNotificacao")
    private Collection<Processo> processoCollection;

	public Long getIdTipoNotificacao() {
		return idTipoNotificacao;
	}

	public void setIdTipoNotificacao(Long idTipoNotificacao) {
		this.idTipoNotificacao = idTipoNotificacao;
	}

	public String getDescricao() {
		return descricao;
	}

	public void setDescricao(String descricao) {
		this.descricao = descricao;
	}

	public Collection<Processo> getProcessoCollection() {
		return processoCollection;
	}

	public void setProcessoCollection(Collection<Processo> processoCollection) {
		this.processoCollection = processoCollection;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime
				* result
				+ ((idTipoNotificacao == null) ? 0 : idTipoNotificacao
						.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		TipoNotificacao other = (TipoNotificacao) obj;
		if (idTipoNotificacao == null) {
			if (other.idTipoNotificacao != null)
				return false;
		} else if (!idTipoNotificacao.equals(other.idTipoNotificacao))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "TipoNotificacao [idTipoNotificacao=" + idTipoNotificacao + "]";
	}
	

}
